package main

import "fmt"

type animal interface {
	eat()
	sleep()
}

type cat struct {
}

func (ccc cat) eat() {
	fmt.Println("cat开始进食")
}
func (ccc cat) sleep() {

}

type dog struct {
}

func (ddd dog) eat() {

}

//	func (ddd dog) sleep() {
//		fmt.Println("dog开始睡觉")
//	}
func (ddd *dog) sleep() {
	fmt.Println("dog开始睡觉")
}

func having(animal2 animal) {
	animal2.eat()
	animal2.sleep()
}
func main() {
	var ccc cat
	var ddd *dog
	having(ccc)
	var an animal = ddd
	an.sleep()
	fmt.Println("=========================")
	//having(ddd)
	ccc.sleep()
	ccc.eat()
}
